<template>
    <div class="header">
      <div class="header-left">
        <div class="iconfont back-icon">&#xe624;</div>
        <div class="iconfont find-icon">&#xe632;</div>
      </div>
      <div class="header-input">
        <input class="header-input-item" @blur="handleToDetail" type="text" placeholder="输入城市/景点">
      </div>
      <router-link to="/city">
        <div class="header-right">
          {{this.city}}
          <span class="iconfont">&#xe6aa;</span>
        </div>
      </router-link>
    </div>
</template>
<script>
import { mapState } from 'vuex'
export default {
  name: 'HomeHeader',
  data () {
    return {
      inputCity: ''
    }
  },
  computed: {
    ...mapState(['city'])
  },
  methods: {
    handleToDetail () {
      this.$router.push('/city')
    }
  }
}
</script>
<style lang='stylus' scoped>
  @import '~styles/varibles.styl'
  .header
    display:flex
    line-height: $headerHeight
    background: $bgColor
    color: #fff
    .header-left
      width: .64rem
      float: left
      .back-icon
        text-align: center
        font-size: .4rem
      .find-icon
        position: absolute
        top: 0
        left: 1rem
        color: #dddddd
    .header-input
      flex: 1
      height: .64rem
      border-radius: .1rem
      margin-left: .2rem
      margin-top: .12rem
      padding-left: 0.2rem
      background #fff
      text-indent: .4rem
      color: #ccc
      line-height: .64rem
      .header-input-item
        line-height .6rem
        height: .6rem
    .header-right
      min-width: 1.04rem
      padding: 0 .1rem
      float: right
      text-align: center
      color: #fff
</style>
